import jakarta.servlet.http.HttpServlet
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse

class LoginServlet:HttpServlet() {
    override fun doGet(req: HttpServletRequest?, resp: HttpServletResponse?) {
        resp?.contentType = "text/html;charset=UTF-8"

        val method = req?.method
        val requestUrl = req?.requestURI
        val webName = req?.contextPath
        val queryString = req?.queryString

        resp?.writer?.write("<h1>下面是获得的字符串</h1>")
        resp?.writer?.write("<h1>method(HTTP方法)</h1>")
        resp?.writer?.write("<h1>$method</h1><br>")
        resp?.writer?.write("<h1>requestURi(请求URI）:</h1>");
        resp?.writer?.write("<h1>$requestUrl</h1><br>");
        resp?.writer?.write("<h1>webname(应用名称):</h1>");
        resp?.writer?.write("<h1>$webName</h1><br>");
        resp?.writer?.write("<h1>querrystring(查询字符串):</h1>");
        resp?.writer?.write("<h1>$queryString</h1>");
    }
}